<template>
	<view class="groupmanage">
		<view v-if="is_staff==1" class="mt-15">
			<uni-row class="" gutter="40">
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/groupinfo')">
						<view class="title">
							<image class="info" :src="onlinePic+'manage/info.png'"></image>
							<view class="groupmanage_row_text">车友会信息管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/groupauditlist')">
						<view class="title">
							<image class="audit_new" :src="onlinePic+'manage/audit_new.png'"></image>
							<view class="groupmanage_row_text">车友会入会审核管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/groupactivelist')">
						<view class="title">
							<image class="activity" :src="onlinePic+'manage/activity.png'"></image>
							<view class="groupmanage_row_text">车友会活动管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/groupactivelisting')">
						<view class="title">
							<image class="activity_audit" :src="onlinePic+'manage/activity_audit.png'"></image>
							<view class="groupmanage_row_text">车友会活动报名审核管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/grouptestdrivelist')">
						<view class="title">
							<image class="tdriver" :src="onlinePic+'manage/tdriver.png'"></image>
							<view class="groupmanage_row_text">车友会试驾管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="scanQRCode()">
						<view class="title">
							<image class="scan" :src="onlinePic+'manage/scan.png'"></image>
							<view class="groupmanage_row_text">活动扫码</view>
						</view>
					</view>
				</uni-col>
			</uni-row>
		</view>
		<view v-if="is_staff==2" class="mt-15">
			<uni-row class="" gutter="40">
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/socgroupalllist')">
						<view class="title">
							<image class="audit_new" :src="onlinePic+'manage/audit_new.png'"></image>
							<view class="groupmanage_row_text">车友会管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/socgroupactivelist')">
						<view class="title">
							<image class="audit" :src="onlinePic+'manage/audit.png'"></image>
							<view class="groupmanage_row_text">活动审核管理</view>
						</view>
					</view>
				</uni-col>
				<uni-col :span="12">
					<view class="groupmanage_row" @click="goPage('/pages/groupmanage/socgroupactiveverifylist')">
						<view class="title">
							<image class="activity_audit" :src="onlinePic+'manage/activity_audit.png'"></image>
							<view class="groupmanage_row_text">活动核销管理</view>
						</view>
					</view>
				</uni-col>
			</uni-row>
		</view>
		<view v-if="is_staff==0" class="page_bottom_loading" :style="'padding-bottom:'+pdbottom+'rpx;'">- 暂无更多 -</view>
	</view>
</template>

<script>
	import {
		getTicketinfo,
	} from '@/api/motortime.js';
	let app = getApp()
	export default {
		data() {
			return {
				is_staff: 0,
				club_id: '',
				picUrl: app.globalData.picUrl,
				onlinePic: app.globalData.onlinePic,
				pdbottom: uni.getSystemInfoSync().safeAreaInsets.bottom ? uni.getSystemInfoSync().safeAreaInsets.bottom +
					140 : 140,
			};
		},
		onShow() {
			if (!uni.getStorageSync('access_token')) {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			}
			if (uni.getStorageSync('userinfo').is_staff == 0) {
				uni.switchTab({
					url: '/pages/index/index'
				})
			}
		},
		onLoad(options) {
			this.club_id = options.club_id
			this.is_staff = uni.getStorageSync('userinfo').is_staff
			var params = {
				event_code: '车友会管理',
				path: 'pages/groupmanage/groupmanage',
				event_id: '',
				title: '',
				source_page: '',
				value: '',
			}
			app.BurialPoint(params)
		},
		methods: {
			goPage(url) {
				if (url == 1) {
					uni.showToast({
						title: '敬请期待',
						mask: true,
						icon: 'none',
						duration: 1500
					})
				} else {
					uni.navigateTo({
						url: url + '?club_id=' + this.club_id
					})
				}
			},
			//管理员扫码
			scanQRCode() {
				var that = this
				uni.showLoading()
				uni.scanCode({
					onlyFromCamera: true,
					success(res) {
						console.log(res)
						if (res.path) {
							uni.navigateTo({
								url: '/' + res.path
							})
							uni.hideLoading()
						} else {
							uni.showToast({
								title: '无效码',
								mask: true,
								icon: 'none',
								duration: 1500
							})
							uni.hideLoading()
						}

					},
					fail() {
						uni.hideLoading()
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.groupmanage {
		padding: 40rpx 30rpx;

		.groupmanage_row {
			width: 324rpx;
			height: 215rpx;
			margin-bottom: 40rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 8rpx;
			background-color: #f1f1f1;

			.title {
				text-align: center;

				.info {
					width: 46rpx;
					height: 46rpx;
				}

				.audit_new {
					width: 53rpx;
					height: 44rpx;
				}

				.activity {
					width: 31rpx;
					height: 43rpx;
				}

				.activity_audit {
					width: 41rpx;
					height: 45rpx;
				}

				.tdriver {
					width: 49rpx;
					height: 49rpx;
				}

				.audit {
					width: 53rpx;
					height: 51rpx;
				}

				.scan {
					width: 43rpx;
					height: 42rpx;
				}

				.groupmanage_row_text {
					color: #000000;
					font-size: 28rpx;
				}
			}
		}
	}
</style>